package com.shoux.api.web.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.shoux.api.tools.MsgUtils;
import com.shoux.api.tools.StringUtils;
import com.shoux.api.web.entity.DicFieldValuesEntity;
import com.shoux.api.web.dao.windSx.DicFieldValuesMapper;
import com.shoux.api.web.entity.MsgEntity;
import com.shoux.api.web.entity.query.QueryForm;
import com.shoux.api.web.service.DicFieldValuesService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 系统字典属性信息表 服务实现类
 * </p>
 *
 * @author chris
 * @since 2022-03-17
 */
@Service
public class DicFieldValuesServiceImpl extends ServiceImpl<DicFieldValuesMapper, DicFieldValuesEntity> implements DicFieldValuesService {


    @Autowired
    private DicFieldValuesMapper dicFieldValuesMapper;

    @Override
    public MsgEntity dictGrid(QueryForm form) {

        LambdaQueryWrapper<DicFieldValuesEntity> queryWrapper = Wrappers.lambdaQuery(DicFieldValuesEntity.class)
                .like(StringUtils.isNotBlank(form.getCode()),DicFieldValuesEntity::getDictCode, form.getCode());
//                .like(StringUtils.isNotBlank(customerQuery.getFddbr()),CompanyCorporateView::getFddbr, customerQuery.getFddbr())
//                .like(StringUtils.isNotBlank(customerQuery.getQylx()),CompanyCorporateView::getQylx, customerQuery.getQylx())
//                .like(StringUtils.isNotBlank(customerQuery.getQymc()),CompanyCorporateView::getQymc, customerQuery.getQymc());

        List<DicFieldValuesEntity> dicFieldValuesList = dicFieldValuesMapper.selectList(queryWrapper);
        return MsgUtils.successWhithData(dicFieldValuesList);
    }
}
